﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TiTi.tea.Model;

namespace TiTi.tea.Dto
{
    public class AddressDto
    {
        public int id { get; set; }

        public int? userId { get; set; }

        public string contacts { get; set; }

        [JsonIgnore]
        public int? Sex { get; set; }
        public bool sex
        {
            get
            {
                return Sex == 1;
            }
        }

        public string tel { get; set; }

        public string location { get; set; }

        public string locationDetail { get; set; }

        public int? isDefault { get; set; }

        public decimal? latitude { get; set; }

        public decimal? longitude { get; set; }

        public AddressDto() { }
        public AddressDto(LocationInfo entity)
        {
            this.id = entity.Id;
            this.userId = entity.UserId;
            this.contacts = entity.Contacts;
            this.Sex = entity.Sex;
            this.tel = entity.Tel;
            this.location = entity.Location;
            this.locationDetail = entity.LocationDetail;
            this.isDefault = entity.IsDefault;
            this.latitude = entity.Latitude;
            this.longitude = entity.Longitude;
        }
    }
}
